package org.gov.vis.master.gui;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.gov.vis.gui.util.GuiUtil;
import org.gov.vis.util.Util;

public class AddDeptDialog extends JDialog{	
	
	private static final long serialVersionUID = -8104819833556859940L;
	private ResourceBundle resources=Util.getResources();
	
	private JLabel deptCodeLabel;
	private JTextField deptCodeTF;
	private JLabel instLabel;
	private JTextField instTF;
	private JLabel villageLabel;
	private JTextField villageTF;
	private JLabel mandalLabel;
	private JTextField mandalTF;
	private JLabel districtLabel;
	private JTextField districtTF;
	
	public AddDeptDialog(Frame owner, String title, boolean modal) {
		super(owner,title,modal);		
		getContentPane().setLayout(new BorderLayout());
		JPanel centerPanel=createCentralPanel();
		add(centerPanel,BorderLayout.CENTER);
		GuiUtil.CompCenterCords cords=GuiUtil.getCompCenterCords(480, 350);
		setBounds(cords.getX(), cords.getY(), 480, 350);		
		setVisible(true);
	}
	
	
	
	/**
	 * creates central panel.
	 * @return JPanel.
	 */
	private JPanel createCentralPanel(){
		JPanel panel=new JPanel(null);
		
		JPanel deptPanel=new JPanel(new GridLayout(5,2));
		deptCodeLabel=GuiUtil.displayLabel(resources.getString("dialog.label.dept.code"));
		deptPanel.add(deptCodeLabel);
		deptCodeTF=new JTextField();
		deptPanel.add(deptCodeTF);
		
		instLabel=GuiUtil.displayLabel(resources.getString("dialog.label.dept.institution"));
		deptPanel.add(instLabel);
		instTF=new JTextField();
		deptPanel.add(instTF);
		
		villageLabel=GuiUtil.displayLabel(resources.getString("dialog.label.dept.village"));
		deptPanel.add(villageLabel);
		villageTF=new JTextField();
		deptPanel.add(villageTF);
		
		mandalLabel=GuiUtil.displayLabel(resources.getString("dialog.label.dept.mandal"));
		deptPanel.add(mandalLabel);
		mandalTF=new JTextField();
		deptPanel.add(mandalTF);
		
		districtLabel=GuiUtil.displayLabel(resources.getString("dialog.label.dept.district"));
		deptPanel.add(districtLabel);
		districtTF=new JTextField();
		deptPanel.add(districtTF);
		
		deptPanel.setBounds(20, 20, 300, 150);
		panel.add(deptPanel);
		
		JButton addDeptBtn=new JButton(resources.getString("dialog.button.dept.addDept"));
		addDeptBtn.setBounds(130, 190, 150, 30);
		panel.add(addDeptBtn);
		
		
		return panel;
	}



	public JLabel getDeptCodeLabel() {
		return deptCodeLabel;
	}



	public JTextField getDeptCodeTF() {
		return deptCodeTF;
	}



	public JLabel getInstLabel() {
		return instLabel;
	}



	public JTextField getInstTF() {
		return instTF;
	}



	public JLabel getVillageLabel() {
		return villageLabel;
	}



	public JTextField getVillageTF() {
		return villageTF;
	}



	public JLabel getMandalLabel() {
		return mandalLabel;
	}



	public JTextField getMandalTF() {
		return mandalTF;
	}



	public JLabel getDistrictLabel() {
		return districtLabel;
	}



	public JTextField getDistrictTF() {
		return districtTF;
	}

}
